#pragma once

#include<unordered_map>
#include<set>
#include<list>
#include<functional>
#include "frpc.h"
#include<filesystem>
#include <utility>

namespace Frpc{
class Context;
class Router {

		std::unordered_map<uint32_t,std::function<void(Request*,Reply*,Context*)>> handlers;
		std::function<void(Request*,Reply*,Context*)> find_handler(uint16_t uri);

		public:
			Router();
			int handler_count(){return handlers.size();}
			bool add_handler(uint16_t uri, std::function<void(Request*,Reply*,Context*)> f);
			//void simple_reply(Request *req, Reply *reply,int,std::string);

			void handle(Request* req,Reply* rep,Context* ctx );
	};
}